﻿<UserControl x:Class="Frontend.GCalendarControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"              
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:backend="clr-namespace:SpeakupBackend;assembly=SpeakupBackend"
             mc:Ignorable="d" 
             d:DesignHeight="700" d:DesignWidth="500">   
    <StackPanel>
        <TextBlock TextWrapping="Wrap" 
                 Padding="10, 10, 10, 20">
            If you want to synchronize all reserved classes with Google Calendar please fill in your account and password.<LineBreak/>
            You will be able to setup email and sms notifications for you classes from Google Calendar Web Site.<LineBreak/>
            <LineBreak/>
            <LineBreak/>
            Make sure that you have enabled Google Calendar functionality for your account. 
            <Hyperlink NavigateUri="https://www.google.com/calendar/" RequestNavigate="Hyperlink_RequestNavigate">Go here </Hyperlink> and check it.<LineBreak/>
            <LineBreak/>
            <LineBreak/>
            Some help links:<LineBreak/>
            
            <Hyperlink NavigateUri="http://www.google.com/support/calendar/" 
                       RequestNavigate="Hyperlink_RequestNavigate">
                Google Calendar help page.
            </Hyperlink><LineBreak/>
            
            <Hyperlink NavigateUri="http://www.google.com/support/calendar/bin/topic.py?topic=15300" 
                       RequestNavigate="Hyperlink_RequestNavigate">                
                Information on how to setup email and sms notification.
            </Hyperlink><LineBreak/>

        </TextBlock>
        <Border BorderThickness="1" BorderBrush="Black" 
                HorizontalAlignment="Center"
                Padding="5">
            <StackPanel>
                <Grid >
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100px" />
                        <ColumnDefinition Width="200px" />
                    </Grid.ColumnDefinitions>
                    <Border Grid.Row="0" 
                            Grid.Column="0" Grid.ColumnSpan="2" 
                            Padding="10">
                        <CheckBox Name="EnableSyncCheckBox" Click="EnableSyncCheckBox_Click">
                            Enable Google Calendar Synchronization
                        </CheckBox>
                    </Border>

                    <Label Grid.Row="1" Grid.Column="0" 
                           HorizontalAlignment="Right" 
                           VerticalAlignment="Center">
                        Google Account:
                    </Label>

                    <Border  Grid.Row="1" 
                             Grid.Column="1" 
                             Padding="5px" >
                        <TextBox Name="NameTextBox" TextChanged="NameTextBox_TextChanged"/>
                    </Border>                      
            
                    <Label Grid.Row="2" Grid.Column="0" 
                           HorizontalAlignment="Right" 
                           VerticalAlignment="Center">
                        Password:
                    </Label>

                    <Border Grid.Row="2" Grid.Column="1" Padding="5" >
                        <PasswordBox Name="PasswordTextBox"  
                                     Padding="2"                                 
                                     PasswordChanged="PasswordTextBox_PasswordChanged"/>
                    </Border>

                    <GroupBox Grid.Row="3" 
                              Grid.Column="0" Grid.ColumnSpan="2"
                              Margin="5" Padding="5" 
                              Header="Notification" BorderBrush="Black"
                              Name="NotificationGroupBox">
                        <GroupBox.Resources>
                            <Style x:Key="TextElementStyle">
                                <Setter Property="FrameworkElement.Margin" Value="3px" />
                                <Setter Property="Control.Padding" Value="3px" />
                                <Setter Property="Control.VerticalContentAlignment" Value="Center" />
                                <Setter Property="Control.VerticalAlignment" Value="Center" />                                
                            </Style>
                        </GroupBox.Resources>
                        
                        <StackPanel Orientation="Vertical" >
                            <Border Style="{StaticResource TextElementStyle}" >
                                <CheckBox Name="EnableNotificationCheckBox" Click="EnableNotificationCheckBox_Click">
                                    Send notifications before each reserved class
                                </CheckBox>
                            </Border>                            
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                
                                <TextBox Name="ReminderValueTextBox" 
                                         Width="30" 
                                         Style="{StaticResource TextElementStyle}"
                                         HorizontalContentAlignment="Right"                                         
                                         Text="2"
                                         TextChanged="ReminderValueTextBox_TextChanged"
                                         PreviewTextInput="ReminderValueTextBox_PreviewTextInput"/>
                                
                                <ComboBox Name="ReminderScaleComboBox" Style="{StaticResource TextElementStyle}" 
                                          SelectionChanged="ReminderScaleComboBox_SelectionChanged">
                                    <ComboBoxItem IsSelected="True">Minutes</ComboBoxItem>
                                    <ComboBoxItem>Hours</ComboBoxItem>
                                    <ComboBoxItem>Days</ComboBoxItem>
                                </ComboBox>
                                <TextBlock Style="{StaticResource TextElementStyle}" >via</TextBlock>
                                <ComboBox  Name="ReminderMethodComboBox" Style="{StaticResource TextElementStyle}" 
                                          SelectionChanged="ReminderMethodComboBox_SelectionChanged">
                                    <ComboBoxItem IsSelected="True">Email</ComboBoxItem>
                                    <ComboBoxItem>Sms</ComboBoxItem>
                                </ComboBox>
                            </StackPanel>                            
                        </StackPanel>
                    </GroupBox>
                
                    <Button Grid.Row="4" 
                            Grid.Column="0" Grid.ColumnSpan="2" 
                            Padding="2" 
                            Name="SyncButton" 
                            Click="SyncButton_Click">
                        Synchronize Now!
                    </Button>

                    <Border Grid.Row="5" 
                            Grid.Column="0" Grid.ColumnSpan="2"
                            Padding="5" 
                            Name="ProgressBarBorder"
                            Visibility="Collapsed">
                        <ProgressBar MinHeight="10" IsIndeterminate="True" />
                    </Border>
                
                    <Border Grid.Row="6" 
                            Grid.Column="0" Grid.ColumnSpan="2"
                            Padding="5"
                            Name="MessageBorder"
                            Visibility="Collapsed" >
                        <TextBlock Name="MessageTextBox" TextWrapping="Wrap" HorizontalAlignment="Center"/>
                    </Border>
                </Grid>
            </StackPanel>
        </Border>
    </StackPanel>    
</UserControl>
